<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="com.byComputer.bo.*"%>
<%@page import="com.byComputer.vo.*"%>
<%
	Cart cart = Cart.getInstance(request);
	List<CartItem> cartItem = cart.getItems();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv=Content-Type content="text/html; charset=utf-8" />
		<link href="../css/style.css" type="text/css" rel="stylesheet" />
	</head>

	<body topMargin="10">

		<div id="append_parent"></div>
		<table cellSpacing="6" cellPadding="2" width="100%" border="0">
			<tbody>
				<tr>
					<td>
						<table class="guide" cellSpacing="0" cellPadding="0" width="100%"
							border="0">
							<tbody>
								<tr>
									<td>
										<a href='/cookbook/index.jsp'>主页</a>&nbsp;/&nbsp;
										<a href='computer_list.jsp'>笔记本订购(WEB007)</a>&nbsp;/&nbsp;购物车信息
									</td>
								</tr>
							</tbody>
						</table>
						<br />
						<table class="tableborder" cellSpacing="0" cellPadding="0"
							width="100%" border="0">
							<tbody>
								<tr class="header">
									<td class="altbg2" colspan="6">
										购物车信息
									</td>
								</tr>
							<tbody>
								<tr>
									<td class="altbg1" width="20%">
										<b>型号</b>
									</td>
									<td class="altbg1" width="20%">
										<b>价格</b>
									</td>
									<td class="altbg1" width="10%">
										<b>数量</b>
									</td>
									<td class="altbg1" width="30">
										&nbsp;
									</td>
									<td class="altbg1" width="10%">
										&nbsp;
									</td>

									<td class="altbg1">
										&nbsp;
									</td>
								</tr>
							</tbody>
							<tbody>
								<%
										if (cartItem.size() > 0) {
										for (CartItem ci : cartItem) {
								%>
								<tr>
									<td class="altbg2">
										<%=ci.getComputer().getModel()%>
									</td>
									<td class="altbg2">
										<%=ci.getComputer().getPrice()%>
									</td>
									<td class="altbg2">
										<%=ci.getNumber()%>
									</td>
									<td class="altbg2">
										<input type="text" size="3" value="3" id="num_<%=ci.getComputer().getId() %>" />
									</td>
									<td class="altbg2">
										<a href="javascript:;"
											onclick="location='update_cart.jsp?num='+document.getElementById('num_<%=ci.getComputer().getId() %>').value+'&id=<%=ci.getComputer().getId() %>'"
											style="color: #9933ff">更改数量</a>
									</td>
									<td class="altbg2">
										<input class="button" type="button" value="删除"
											onclick="window.location='delete_cart.jsp?computerId=<%=ci.getComputer().getId()%>'" />
										<%--当我们需要动态的时候可以选择用onclick＝"location=....." --%>
									</td>
								</tr>
								<%
								}
								%>
								<tr>
									<td class="altbg1" colspan="6">
										<b> ￥<%=cart.getTotalPrice()%> </b>
									</td>
								</tr>
								<%
								} else {
								%>
								<tr>
									<td class="altbg2" colspan="6">
										<b>还没有选购商品</b>
									</td>
								</tr>
								<%
								}
								%>
							</tbody>
						</table>
						<br />
						<center>
							<input class="button" type="button" value="返回商品列表"
								name="settingsubmit" onclick="location = 'computer_list.jsp';">
							<input class="button" type="button" value="清空购物车"
								name="settingsubmit"
								onclick="location = 'update_cart.jsp?option=clear';">
						</center>
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>
